import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class WinDialog extends JDialog{
	CardClient main;
	JButton ok=new JButton("确定");
	
    public WinDialog(CardClient main, String name) {
    	super(main,name+" Win!",true);
    	this.main=main;
    	setSize(200,100);
    	setResizable(false);
    	setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    	init();
	}
	
	private void init(){
		getContentPane().setLayout(new BorderLayout());
    	ok.addActionListener(new java.awt.event.ActionListener(){
			public void actionPerformed(ActionEvent e){
				main.newGame();
				dispose();
			}
		});
    	getContentPane().add(ok,"Center");
	}
	
	public void dispose(){
		main.newGame();
		super.dispose();		
	}    
    
}